package com.info33.platform.business.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.info33.platform.business.app.dto.AppRoleDTO;
import com.info33.platform.business.app.entity.AppMenu;
import com.info33.platform.business.app.entity.AppMenuRole;
import com.info33.platform.business.app.entity.AppRole;
import com.info33.platform.business.app.vo.AppMenuVO;
import com.info33.platform.business.app.vo.AppRoleVO;
import com.info33.platform.business.app.vo.AppTenantUserVO;
import com.info33.platform.system.dto.SysUserDTO;
import com.info33.platform.system.vo.SysUserVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author admin
 */
@Repository
public interface AppMenuRoleDao extends BaseMapper<AppMenuRole> {

    /**
     * pc - 拥有权限的用户
     *
     * @param page-
     * @param dto-
     * @return -
     */
    IPage<SysUserVO> pcUser(@Param("page") Page<SysUserVO> page, @Param("dto") SysUserDTO dto);

    /**
     * pc - 拥有权限的角色
     *
     * @param page-
     * @param dto-
     * @return -
     */
    IPage<AppRoleVO> pcRole(Page<AppRole> page, AppRoleDTO dto);

    /**
     * pc - 拥有权限的某用户详情
     *
     * @param uid-
     * @return -
     */
    AppTenantUserVO pcUserDetail(@Param("uid") Long uid);

    /**
     * pc - 拥有权限的某角色详情
     *
     * @param rid-
     * @return -
     */
    AppRoleVO pcRoleDetail(@Param("rid") Long rid);

    /**
     * pc - 绑定全部的菜单 id 集合
     *
     * @param tenantId-
     * @return -
     */
    List<AppMenuVO> pcAll(@Param("tenantId") Long tenantId);

    /**
     * 获取某用户所拥有的菜单路由集合
     *
     * @param sysUserVO-
     * @return -
     */
    List<Long> getUserMenuIds(@Param("sysUserVO") SysUserVO sysUserVO);

    /**
     * 获取某用户所拥有的菜单集合
     *
     * @param sysUserVO-
     * @return -
     */
    List<AppMenu> appHomeMenuToSort(@Param("sysUserVO") SysUserVO sysUserVO);

    /**
     * 用户 app 首页可以排序的菜单
     *
     * @param currentUser 当前用户 app 租户用户
     * @return -
     */
    List<AppMenu> appHomeMenu(@Param("sysUserVO") SysUserVO currentUser);
}